package 力扣._00周赛._115双周赛.题目2;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class Solution {
    //100078. 最长相邻不相等子序列 I
    //生成使g【】的相邻不等的下标子序列
    public List<String> getWordsInLongestSubsequence(int n, String[] words, int[] groups) {
        List<Integer> indexs = new LinkedList<>();
        for (int i = 0; i < n-1; i++) {
            if(groups[i]!=groups[i+1])
                indexs.add(i);
        }
        indexs.add(n-1);
        List<String> r = new ArrayList<>();
        for (Integer index : indexs) {
            r.add(words[index]);
        }
        return r;

    }

}
